﻿using System;
using System.Web.UI;
using Crimson;
using Crimson.Module;

public partial class Foshi_Default : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownList1.DataSource = InfoManager.DaoFactory.InfoDao.GetYear("佛事", true);
            DropDownList1.DataBind();

            Bind(DateTime.Now.Year);
        }
    }

    private void Bind(int year)
    {
        var start = new DateTime(year, 1, 1);
        var end = new DateTime(year, 12, 31, 23, 59, 59);
        Repeater1.DataSource = InfoManager.DaoFactory.InfoDao.Find("佛事", start, end, InfoState.Published, true);
        Repeater1.DataBind();
    }

    protected void Search_OnClick(object sender, EventArgs e)
    {
        int s = Int32.Parse(DropDownList1.SelectedValue);
        Bind(s);
    }
}